package huTool;

import cn.hutool.core.io.FileUtil;

import java.io.File;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.List;

public class Demo1 {
    public static void main(String[] args) {
        //hutool的常见用法
        File src = new File("D:\\temp\\Jakc");
        File dest = new File("D:\\temp\\liuhe");
        //创建文件
        FileUtil.file("IODemo\\seeyou.txt");
        //根据文件参数创建文件
        FileUtil.touch("D:\\","\\temp\\a.txt");
        //将集合中数据写入到文件中
        ArrayList<String> list = new ArrayList<>();
        list.add("jack");
        list.add("jack");
        list.add("k");
        FileUtil.writeLines(list,"IODemo\\ss.txt","UTF-8");
        //读取数据
        ArrayList<String> list1 = (ArrayList<String>) FileUtil.readLines("IODemo\\ss.txt", "UTF-8");
        for (String s : list) {
            System.out.println(s);
        }
        //copy 复制
        FileUtil.appendLines(list,"D:\\temp\\jack.txt","UTF-8");

    }
}
